<template>
  <!-- 检查事项 -->
  <div class="dialog-container">
    <el-dialog
      :title="'详情'"
      :visible="dialogVisible"
      @open="initData"
      @close="closeDialog"
    >
      <el-form
        ref="form"
        :model="dataForm"
        class="dialog-form"
        :rules="rules"
        label-width="110px"
        size="mini"
        :disabled="true"
      >
        <el-row>
          <el-col :span="12">
            <el-form-item label="排口名称" prop="outletName">
              <el-input v-model="dataForm.outletName" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="mn" prop="mn">
              <el-input v-model="dataForm.mn" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="报文类型" prop="dataType">
              <el-input v-model="dataForm.dataType" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="解析状态" prop="packetStatus">
              <el-input v-model="dataForm.packetStatus" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="报文时间" prop="messageTime">
              <el-input v-model="dataForm.messageTime" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-form-item label="报文内容" prop="content">
          <el-input v-model="dataForm.content" type="textarea" :rows="5" maxlength="255" />
        </el-form-item>
      </el-form>
    </el-dialog>
  </div>
</template>

<script>
import { getDictLabel, parseTime } from '@/utils'

export default {
  name: 'DetailsDialog',
  props: {
    dialogVisible: {
      type: Boolean,
      default: false
    },
    obj: {
      type: Object,
      default: null
    }
  },
  data() {
    return {
      value1: 5,
      value2: 5,
      dataForm: {}
    }
  },
  created() {

  },
  methods: {
    initData() {
      this.obj.packetStatus = getDictLabel('e037', this.obj.packetStatus)
      this.obj.dataType = getDictLabel('e038', this.obj.dataType)
      this.obj.messageTime = parseTime(this.obj.messageTime, '{y}-{m}-{d} {h}:{i}:{s}')

      this.dataForm = this.obj
    },
    closeDialog() {
      this.$emit('closeDialog')
      this.clearData()
    },
    clearData() {
      this.dataForm = {

      }
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
